<template lang="">
  <div>
    <div class="ser_div">
      <el-row>
        <el-col :span="4">
          <!-- <el-button
            @click="model_number_click"
            style="margin-left: 15px; background: #1890ff; color: aliceblue"
          >
            搜索</el-button
          > -->
          <el-button
            @click="add_model"
            style="background: #1890ff; color: aliceblue"
            >新增字段</el-button
          >
        </el-col>
      </el-row>
    </div>
    <el-table :data="ModelList" stripe style="width: 100%" border>
      <el-table-column prop="field" label="字段"> </el-table-column>
      <el-table-column prop="name" label="字段名称"> </el-table-column>
      <el-table-column prop="formtype" label="字段类型"> </el-table-column>
      <el-table-column prop="required" label="是否必填"> 
        <template slot-scope="scope">
          <span>{{scope.row.required==1?'必填':'非必填'}}</span>
        </template>
      </el-table-column>
      <el-table-column label="操作" width="250" fixed="right">
        <template slot-scope="scope">
          <el-button
            @click="set_ziduan(scope.row)"
            type="text"
            style="margin-left: 10px"
            >修改</el-button
          >
          <el-popconfirm
            confirm-button-text="确定"
            cancel-button-text="取消"
            icon="el-icon-info"
            icon-color="red"
            title="确定删除该模型吗？"
            @confirm="del_moxing(scope.row)"
          >
            <el-button slot="reference" type="text" style="margin-left: 10px"
              >删除</el-button
            >
          </el-popconfirm>
        </template>
      </el-table-column>
    </el-table>
  </div>
</template>
<script>
import { getModelFieldList } from "@/api/product/index";
export default {
  data() {
    return {
      ModelList: [],
    };
  },
  mounted() {
    console.log(this.$route.query);
    this.get_ModelFieldList(this.$route.query.data);
  },
  methods: {
    get_ModelFieldList(id) {
      console.log(id);
      getModelFieldList({ modelid: id }).then((res) => {});
    },
    set_ziduan() {},
    del_moxing() {},
  },
};
</script>
<style lang=""></style>
